/**
 * #info
 *
 *@author   wuwg
 *@createTime   2018/04/07
 *@updateTime   2018/04/08
 *@description  form-item  component form-item 组件
 */
/**
 * #item
 *
 * @type         aty-form-item
 * @cn             表单条目
 * @nameprop   label
 * @menu         表单
 * @order    1002
 * @stPlugin     false
 * @stContainer  true
 * @parents         [aty-form]
 * @mixins      [./components/components/form/form-item/form-item.js],
 */
import config from '../../../config/config.js'
import formItem from '../form-item/form-item.js'

// prefix
const componentName = config.prefix + '-form-item'
// module
const module = {
  name: componentName,
  mixins: [formItem],
  components: {},
  props: {
    /**
     * #property
     *
     * @name    text
     * @cn      文本
     * @type	text
     * @description text 主要用于后端aty-dict的解析
     */
    text:{
      type:String
    },
    /**
     * #property
     *
     * @name    endfix
     * @cn      文本后缀
     * @type	text
     * @description 文本后缀
     */
    endfix:{
      type:String
    },
    /**
     * #property
     *
     * @name    formatter
     * @cn      格式化函数
     * @type	text
     * @bind    must
     * @description  用于格式化文本
     */
    formatter: Function
  },
  data () {
    return {}
  },
  watch: {
  },
  computed: {
    wrapClasses () {
      return [
        `${componentName}-wrapper`
      ].concat(this.formItemClasses)
    },
    wrapStyles () {
      return this.formItemStyles
    },
    currentText() {
      let temp = this.formatter && this.text ? this.formatter(this.text) : this.text;
      if(this.endfix) {
          return temp + this.endfix;
      }
      return temp;
    }
  },
  methods: {
  },
  updated () {
  },
  created () {
  },
  mounted () {
  },
  beforeDestroy () {
  }
}
export default module
